﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Data.Linq.Mapping;
using System.ComponentModel;

namespace STS.Model
{
    [Table]
    public class Wizyta : INotifyPropertyChanged, INotifyPropertyChanging
    {
        private int id;

        [Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]
        public int Id
        {
            get { return id; }
            set
            {
                if (id != value)
                {
                    NotifyPropertyChanging("Id");
                    id = value;
                    NotifyPropertyChanged("Id");
                }
            }
        }

        private int idWizyty;

        [Column]
        public int IdWizyty
        {
            get { return idWizyty; }
            set
            {
                if (idWizyty != value)
                {
                    NotifyPropertyChanging("IdWizyty");
                    idWizyty = value;
                    NotifyPropertyChanged("IdWizyty");
                }
            }
        }

        private double waga;

        [Column]
        public double Waga
        {
            get { return waga; }
            set
            {
                if (waga != value)
                {
                    NotifyPropertyChanging("Waga");
                    waga = value;
                    NotifyPropertyChanged("Waga");
                }
            }
        }

        private string cisnienie;

        [Column]
        public string Cisnienie
        {
            get { return cisnienie; }
            set
            {
                if (cisnienie != value)
                {
                    NotifyPropertyChanging("Cisnienie");
                    cisnienie = value;
                    NotifyPropertyChanged("Cisnienie");
                }
            }
        }

        private DateTime data;

        [Column]
        public DateTime Data
        {
            get { return data; }
            set
            {
                if (data != value)
                {
                    NotifyPropertyChanging("Data");
                    data = value;
                    NotifyPropertyChanged("Data");
                }
            }
        }

        private int idLekarza;

        [Column]
        public int IdLekarza
        {
            get { return idLekarza; }
            set
            {
                if (idLekarza != value)
                {
                    NotifyPropertyChanging("IdLekarza");
                    idLekarza = value;
                    NotifyPropertyChanged("IdLekarza");
                }
            }
        }

        private int idPacjenta;

        [Column]
        public int IdPacjenta
        {
            get { return idPacjenta; }
            set
            {
                if (idPacjenta != value)
                {
                    NotifyPropertyChanging("IdPacjenta");
                    idPacjenta = value;
                    NotifyPropertyChanged("IdPacjenta");
                }
            }
        }


        public event PropertyChangedEventHandler PropertyChanged;

        public event PropertyChangingEventHandler PropertyChanging;

        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        private void NotifyPropertyChanging(string propertyName)
        {
            if (PropertyChanging != null)
            {
                PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
            }
        }

        public override string ToString()
        {
            return String.Format("Id: {0} Nazwa: {1} IdTypLekarza: {2}", Id, Cisnienie, IdWizyty);
        }
    }
}
